package com.ctl.regex;

/**
 * <p>Title: PasswordTest</p >
 * <p>Description: password 大小写字母+数字+特殊字符</p >
 * <p>Copyright: Copyright (c) 2022</p >
 * <p>Company: www.ctl.com</p >
 *
 * @author ctl
 * @version 1.1
 * @date 2022-04-06 17:36
 */
public class PasswordTest {

    public static final String PW_PATTERN="^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{6,18}$";
        public static void main(String[] args){
            System.out.println("12345678".matches(PW_PATTERN));
            System.out.println("abcdefgh".matches(PW_PATTERN));
            System.out.println("ABCDEFGH".matches(PW_PATTERN));
            System.out.println("!@#$%^&*".matches(PW_PATTERN));

            System.out.println("A2345678".matches(PW_PATTERN));
            System.out.println("Abc".matches(PW_PATTERN));
            System.out.println("Ab1".matches(PW_PATTERN));
            System.out.println("Ab123456".matches(PW_PATTERN));
            System.out.println("Ab14?".matches(PW_PATTERN));
        }
}
